<template>
<div>
    <el-form :inline="true" :model="issue" class="demo-form-inline">
    <el-form-item label="试题题干：">
        <el-input v-model="issue.content" placeholder="请输入"></el-input>
    </el-form-item>
    <el-form-item label="试题类型：">
        <el-select v-model="issue.type" placeholder="请选择">
        <el-option label="单选" value="1"></el-option>
        <el-option label="多选" value="2"></el-option>
        <el-option label="判断" value="3"></el-option>
        <el-option label="填空" value="4"></el-option>
        <el-option label="问答" value="5"></el-option>
        </el-select>
    </el-form-item>
    <el-form-item label="难度：">
        <el-select v-model="issue.level" placeholder="请选择难度">
        <el-option label="简单" value="1"></el-option>
        <el-option label="中等" value="2"></el-option>
        <el-option label="困难" value="3"></el-option>
        </el-select>
    </el-form-item>
    <el-form-item>
        <!-- 点击触发查询函数 -->
        <el-button type="primary" @click="query()">查询</el-button>
    </el-form-item>
    <el-form-item>
        <el-button type="primary" @click="reset()">重置</el-button>
    </el-form-item>
    </el-form>
    <el-row>
      <el-button type="primary" ><router-link to="/issue/add" style="color:white">新增试题</router-link></el-button>
      <el-button type="success" >批量导入</el-button>
    </el-row>
</div>
    
</template>
<script>
  export default {
    data() {
      return {
        issue: {
          content: '',
          type:'',
          level: ''
        }
      }
    },
    methods: {
      //作用:查询函数中向父组件发送难度 | 函数参数:子组件标签的自定义属性,类型及题干json参数
      query() {
        this.$emit("listenToChild",this.issue)
      },
      reset(){
        let question={
          content: '',
          type:'',
          level: ''
        }
        this.issue = question
        this.query()
      }
    }
  }
</script>